.class public Lcom/estrongs/android/taskmanager/CacheManWrapper;
.super Lcom/estrongs/android/taskmanager/ic;


# static fields
.field private static final SORT_BY_CACHESIZE_ASC:I = 0x1

.field private static final SORT_BY_CACHESIZE_DEFAULT:I = 0x0

.field private static final SORT_BY_CACHESIZE_DSC:I = -0x1

.field public static final TAG:Ljava/lang/String; = "CacheMan"


# instance fields
.field private appMan:Lcom/estrongs/android/taskmanager/tools/ApplicationMan;

.field cacheSummary:Landroid/widget/TextView;

.field content:Landroid/view/View;

.field currentAppInfo:Landroid/content/pm/ApplicationInfo;

.field private disableSharedPrefs:Landroid/content/SharedPreferences;

.field empty:Landroid/view/View;

.field protected isLoading:Z

.field mAdapter:Lcom/estrongs/android/taskmanager/l;

.field private mAm:Landroid/app/ActivityManager;

.field mList:Ljava/util/List;

.field mListView:Landroid/widget/ListView;

.field private mPm:Landroid/content/pm/PackageManager;

.field private pkgDataObserver:Lcom/estrongs/android/taskmanager/tools/d;

.field protected pkgStatsMap:Ljava/util/HashMap;

.field progress:Landroid/view/View;

.field sortType:I

.field protected statsGotCount:I

.field protected totalCacheSize:J


# direct methods
.method public constructor <init>(Landroid/app/Activity;Landroid/view/ViewGroup;)V
    .locals 1

    const/4 v0, 0x1

    invoke-direct {p0, p1, p2, v0}, Lcom/estrongs/android/taskmanager/CacheManWrapper;-><init>(Landroid/app/Activity;Landroid/view/ViewGroup;Z)V

    return-void
.end method

.method public constructor <init>(Landroid/app/Activity;Landroid/view/ViewGroup;Z)V
    .locals 3

    const/4 v0, 0x0

    const/4 v2, 0x0

    invoke-direct {p0, p1, p2, p3}, Lcom/estrongs/android/taskmanager/ic;-><init>(Landroid/app/Activity;Landroid/view/ViewGroup;Z)V

    iput-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mPm:Landroid/content/pm/PackageManager;

    iput-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mAm:Landroid/app/ActivityManager;

    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mList:Ljava/util/List;

    iput-boolean v2, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->isLoading:Z

    iput v2, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->statsGotCount:I

    const-wide/16 v0, 0x0

    iput-wide v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->totalCacheSize:J

    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    iput-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->pkgStatsMap:Ljava/util/HashMap;

    iput v2, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->sortType:I

    invoke-virtual {p1}, Landroid/app/Activity;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v0

    iput-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mPm:Landroid/content/pm/PackageManager;

    const-string v0, "activity"

    invoke-virtual {p1, v0}, Landroid/app/Activity;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/ActivityManager;

    iput-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mAm:Landroid/app/ActivityManager;

    const v0, 0x102000a

    invoke-virtual {p0, v0}, Lcom/estrongs/android/taskmanager/CacheManWrapper;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ListView;

    iput-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mListView:Landroid/widget/ListView;

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mListView:Landroid/widget/ListView;

    const v1, 0x106000d

    invoke-virtual {v0, v1}, Landroid/widget/ListView;->setSelector(I)V

    new-instance v0, Lcom/estrongs/android/taskmanager/l;

    invoke-direct {v0, p1, p0}, Lcom/estrongs/android/taskmanager/l;-><init>(Landroid/app/Activity;Lcom/estrongs/android/taskmanager/CacheManWrapper;)V

    iput-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mAdapter:Lcom/estrongs/android/taskmanager/l;

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mListView:Landroid/widget/ListView;

    iget-object v1, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mAdapter:Lcom/estrongs/android/taskmanager/l;

    invoke-virtual {v0, v1}, Landroid/widget/ListView;->setAdapter(Landroid/widget/ListAdapter;)V

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mListView:Landroid/widget/ListView;

    invoke-virtual {v0, v2}, Landroid/widget/ListView;->setCacheColorHint(I)V

    const v0, 0x7f090051

    invoke-virtual {p0, v0}, Lcom/estrongs/android/taskmanager/CacheManWrapper;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->cacheSummary:Landroid/widget/TextView;

    const v0, 0x7f090054

    invoke-virtual {p0, v0}, Lcom/estrongs/android/taskmanager/CacheManWrapper;->findViewById(I)Landroid/view/View;

    move-result-object v0

    iput-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->progress:Landroid/view/View;

    const v0, 0x7f090052

    invoke-virtual {p0, v0}, Lcom/estrongs/android/taskmanager/CacheManWrapper;->findViewById(I)Landroid/view/View;

    move-result-object v0

    iput-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->content:Landroid/view/View;

    const v0, 0x7f090053

    invoke-virtual {p0, v0}, Lcom/estrongs/android/taskmanager/CacheManWrapper;->findViewById(I)Landroid/view/View;

    move-result-object v0

    iput-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->empty:Landroid/view/View;

    new-instance v0, Lcom/estrongs/android/taskmanager/tools/ApplicationMan;

    invoke-direct {v0, p1}, Lcom/estrongs/android/taskmanager/tools/ApplicationMan;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->appMan:Lcom/estrongs/android/taskmanager/tools/ApplicationMan;

    const v0, 0x7f090057

    invoke-virtual {p0, v0}, Lcom/estrongs/android/taskmanager/CacheManWrapper;->findViewById(I)Landroid/view/View;

    move-result-object v0

    new-instance v1, Lcom/estrongs/android/taskmanager/p;

    invoke-direct {v1, p0}, Lcom/estrongs/android/taskmanager/p;-><init>(Lcom/estrongs/android/taskmanager/CacheManWrapper;)V

    invoke-virtual {v0, v1}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    const v0, 0x7f090056

    invoke-virtual {p0, v0}, Lcom/estrongs/android/taskmanager/CacheManWrapper;->findViewById(I)Landroid/view/View;

    move-result-object v0

    new-instance v1, Lcom/estrongs/android/taskmanager/r;

    invoke-direct {v1, p0}, Lcom/estrongs/android/taskmanager/r;-><init>(Lcom/estrongs/android/taskmanager/CacheManWrapper;)V

    invoke-virtual {v0, v1}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    const v0, 0x7f090058

    invoke-virtual {p0, v0}, Lcom/estrongs/android/taskmanager/CacheManWrapper;->findViewById(I)Landroid/view/View;

    move-result-object v0

    new-instance v1, Lcom/estrongs/android/taskmanager/s;

    invoke-direct {v1, p0}, Lcom/estrongs/android/taskmanager/s;-><init>(Lcom/estrongs/android/taskmanager/CacheManWrapper;)V

    invoke-virtual {v0, v1}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    return-void
.end method

.method static synthetic access$0(Lcom/estrongs/android/taskmanager/CacheManWrapper;)Lcom/estrongs/android/taskmanager/tools/ApplicationMan;
    .locals 1

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->appMan:Lcom/estrongs/android/taskmanager/tools/ApplicationMan;

    return-object v0
.end method

.method static synthetic access$1(Lcom/estrongs/android/taskmanager/CacheManWrapper;)V
    .locals 0

    invoke-direct {p0}, Lcom/estrongs/android/taskmanager/CacheManWrapper;->sort()V

    return-void
.end method

.method private doSort(I)V
    .locals 2

    new-instance v0, Lcom/estrongs/android/taskmanager/w;

    invoke-direct {v0, p0, p1}, Lcom/estrongs/android/taskmanager/w;-><init>(Lcom/estrongs/android/taskmanager/CacheManWrapper;I)V

    const/4 v1, 0x0

    new-array v1, v1, [Ljava/lang/Void;

    invoke-virtual {v0, v1}, Lcom/estrongs/android/taskmanager/w;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    return-void
.end method

.method private loadAppStats(Ljava/util/List;)V
    .locals 3

    const/4 v2, 0x0

    iput v2, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->statsGotCount:I

    const-wide/16 v0, 0x0

    iput-wide v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->totalCacheSize:J

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->pkgStatsMap:Ljava/util/HashMap;

    invoke-virtual {v0}, Ljava/util/HashMap;->clear()V

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mList:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->clear()V

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->isLoading:Z

    new-instance v0, Lcom/estrongs/android/taskmanager/u;

    invoke-direct {v0, p0, p1}, Lcom/estrongs/android/taskmanager/u;-><init>(Lcom/estrongs/android/taskmanager/CacheManWrapper;Ljava/util/List;)V

    new-array v1, v2, [Ljava/lang/Void;

    invoke-virtual {v0, v1}, Lcom/estrongs/android/taskmanager/u;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    return-void
.end method

.method private sort()V
    .locals 4

    const/4 v3, -0x1

    const/4 v2, 0x1

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mList:Ljava/util/List;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mList:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-gt v2, v0, :cond_0

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->progress:Landroid/view/View;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/view/View;->setVisibility(I)V

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->content:Landroid/view/View;

    const/16 v1, 0x8

    invoke-virtual {v0, v1}, Landroid/view/View;->setVisibility(I)V

    iget v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->sortType:I

    if-nez v0, :cond_1

    iput v3, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->sortType:I

    invoke-direct {p0, v3}, Lcom/estrongs/android/taskmanager/CacheManWrapper;->doSort(I)V

    :cond_0
    :goto_0
    return-void

    :cond_1
    iget v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->sortType:I

    if-ne v2, v0, :cond_2

    iput v3, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->sortType:I

    invoke-direct {p0, v3}, Lcom/estrongs/android/taskmanager/CacheManWrapper;->doSort(I)V

    goto :goto_0

    :cond_2
    iput v2, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->sortType:I

    invoke-direct {p0, v2}, Lcom/estrongs/android/taskmanager/CacheManWrapper;->doSort(I)V

    goto :goto_0
.end method


# virtual methods
.method public checkCacheClean()V
    .locals 3

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->currentAppInfo:Landroid/content/pm/ApplicationInfo;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->appMan:Lcom/estrongs/android/taskmanager/tools/ApplicationMan;

    iget-object v1, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->currentAppInfo:Landroid/content/pm/ApplicationInfo;

    iget-object v1, v1, Landroid/content/pm/ApplicationInfo;->packageName:Ljava/lang/String;

    new-instance v2, Lcom/estrongs/android/taskmanager/t;

    invoke-direct {v2, p0}, Lcom/estrongs/android/taskmanager/t;-><init>(Lcom/estrongs/android/taskmanager/CacheManWrapper;)V

    invoke-virtual {v0, v1, v2}, Lcom/estrongs/android/taskmanager/tools/ApplicationMan;->fetchPackageStats(Ljava/lang/String;Landroid/content/pm/IPackageStatsObserver;)V

    :goto_0
    return-void

    :cond_0
    invoke-virtual {p0}, Lcom/estrongs/android/taskmanager/CacheManWrapper;->refresh()V

    goto :goto_0
.end method

.method public getApplicationList()Ljava/util/List;
    .locals 1

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mList:Ljava/util/List;

    return-object v0
.end method

.method protected getViewResId()I
    .locals 1

    const v0, 0x7f03000a

    return v0
.end method

.method onDataPrepared()V
    .locals 2

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->isLoading:Z

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mActivity:Landroid/app/Activity;

    new-instance v1, Lcom/estrongs/android/taskmanager/y;

    invoke-direct {v1, p0}, Lcom/estrongs/android/taskmanager/y;-><init>(Lcom/estrongs/android/taskmanager/CacheManWrapper;)V

    invoke-virtual {v0, v1}, Landroid/app/Activity;->runOnUiThread(Ljava/lang/Runnable;)V

    return-void
.end method

.method public refresh()V
    .locals 3

    iget-boolean v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->isLoading:Z

    if-eqz v0, :cond_0

    :goto_0
    return-void

    :cond_0
    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->cacheSummary:Landroid/widget/TextView;

    iget-object v1, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mActivity:Landroid/app/Activity;

    const v2, 0x7f07007a

    invoke-virtual {v1, v2}, Landroid/app/Activity;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->progress:Landroid/view/View;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/view/View;->setVisibility(I)V

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->content:Landroid/view/View;

    const/16 v1, 0x8

    invoke-virtual {v0, v1}, Landroid/view/View;->setVisibility(I)V

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mPm:Landroid/content/pm/PackageManager;

    const/16 v1, 0x2000

    invoke-virtual {v0, v1}, Landroid/content/pm/PackageManager;->getInstalledApplications(I)Ljava/util/List;

    move-result-object v0

    invoke-direct {p0, v0}, Lcom/estrongs/android/taskmanager/CacheManWrapper;->loadAppStats(Ljava/util/List;)V

    goto :goto_0
.end method

.method public setCurrentApplicationInfo(Landroid/content/pm/ApplicationInfo;)V
    .locals 0

    iput-object p1, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->currentAppInfo:Landroid/content/pm/ApplicationInfo;

    return-void
.end method

.method public setOnTouchListener(Landroid/view/View$OnTouchListener;)V
    .locals 1

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->mListView:Landroid/widget/ListView;

    invoke-virtual {v0, p1}, Landroid/widget/ListView;->setOnTouchListener(Landroid/view/View$OnTouchListener;)V

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->progress:Landroid/view/View;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/estrongs/android/taskmanager/CacheManWrapper;->progress:Landroid/view/View;

    invoke-virtual {v0, p1}, Landroid/view/View;->setOnTouchListener(Landroid/view/View$OnTouchListener;)V

    :cond_0
    return-void
.end method
